/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ling
 * Date: 2023-11-10
 * Time: 8:53
 */
public class Car {
    private double speed;//速度

    public Car(double speed){
        this.speed=speed;
    }

    public Car()
    {
        this.speed = 10;
    }

    //车辆加速
    public void accelerate(double increment){
        speed+=increment;
        System.out.println("车辆已加速，当前速度为："+speed);
    }

    //车辆减速
    public void decelerate(double decrement){
        speed-=decrement;
        System.out.println("车辆已减速，当前速度为："+speed);
    }

    //刹车
    public void brake(){
        speed=0.0d;
    }
}
